﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using XB.Core.MemoryStore.TimeSchduler;

namespace MemoryStore.Core.Test
{
    [TestClass]
    public class TaskSchedulerTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            var taskScheduler = new TimedTaskScheduler("adsfasf");

            taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 13s", 13));
            taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 33s", 33));

            var taskScheduler2 = new TimedTaskScheduler("adsfasf22222");

            taskScheduler2.RegisterTask(new TestMemoryStore("taskScheduler2 memorystore1 for 13s", 13));
            taskScheduler2.RegisterTask(new TestMemoryStore("taskScheduler2 memorystore1 for 33s", 33));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore2 for 10s", 10));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore3 for 10s", 10));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 15s", 15));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 30s", 30));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 60s", 60));
            //taskScheduler.RegisterTask(new TestMemoryStore("memorystore1 for 55s", 55));

            taskScheduler.EnsureRunning();

            System.Threading.Thread.Sleep(3000);
            taskScheduler2.EnsureRunning();

            while (true)
            {
                System.Threading.Thread.Sleep(5000);
            }
        }
    }
}
